package com.cn.serverline.lineicp.productionLine.enums;

import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import lombok.Getter;

/**
 * 产品型号编码
 *
 * @author Gmr
 * @since 2024/7/29
 */
@Getter
public enum ModelNodeCodeEnum {

	MODEL_NODE_CODE_ONE("A", "T月1日-部装物料接收"),
	MODEL_NODE_CODE_TWO("B", "部装物料接收-开始部装"),
	MODEL_NODE_CODE_THREE("C", "开始部装-结束部装"),
	MODEL_NODE_CODE_FOUR("D", "结束部装-开始总装"),
	MODEL_NODE_CODE_FIVE("E", "T月1日-总装物料接收"),
	MODEL_NODE_CODE_SIX("F", "总装物料接收-开始总装"),
	MODEL_NODE_CODE_SEVEN("G", "开始总装-结束总装"),
	MODEL_NODE_CODE_EIGHT("H", "结束总装-完成调式"),
	MODEL_NODE_CODE_NINE("I", "完成调试-转验收"),
	MODEL_NODE_CODE_TEN("J", "转验收-交付");

	private final String code;

	private final String desc;

	ModelNodeCodeEnum(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	public static void validate(String code) {
		for (ModelNodeCodeEnum modelNodeCodeEnum : ModelNodeCodeEnum.values()) {
			if (modelNodeCodeEnum.getCode().equals(code)) {
				return;
			}
		}
		throw new ServiceException(ModelNodeLibraryException.MODEL_NODE_CODE_NOT_EXIST);
	}
}
